/**
 * 时间格式化
 * filters: {
    fliterTime: function(val){
        return dateFilter(val,3)
    }
 */
 export const dateFilter = (time, type) => {
    let date = new Date(time * 1000)
    let year = date.getFullYear()
    let month = date.getMonth() + 1
    let day = date.getDate()
    let hours = date.getHours()
    let minutes = date.getMinutes()
    let second = date.getSeconds()
    let result
    switch (type) {
      case 0: // 01-05
        result = `${format(month)}月${format(day)}日`
        break
      case 1: // 11:12
        result = `${format(hours)}-${format(minutes)}`
        break
      case 2: // 2015-01-05
        result = `${year}-${format(month)}-${format(day)}`
        break
      case 3: // 2015-01-05 11:12
        result = `${year}-${format(month)}-${format(day)}  ${format(hours)}:${format(minutes)}:${format(second)}`
        break
      case 4: // 2015-01-05 11:12:06
        result = `${year}.${month}.${day}  ${hours}:${minutes}`
        break
      case 5:
        result = `${year}年${format(month)}月${format(day)}日${format(hours)}时${format(minutes)}分`
        break
    }
    return result
  };
 // 判断控对象、控数组、空串、0
export const isNull = (data) => {
    if (typeof data == "undefined" || data == null || data == '' || (typeof data === "object" && (data instanceof Array) && data.length == 0)) {
      return true;
    } else {
      if (typeof data === "object" && !(data instanceof Array)) {
        var hasProp = false;
        for (var prop in data) {
          hasProp = true;
          break;
        }
        if (!hasProp) {
          return true;
        }
      }
      return false;
    }
  }